/* ClientListener.java 
* Created on Dec 6, 2012 
*@Author: Mr.Viet 
*@Phone: 01683430426 
*@Email: phamvanvietcdhd@gmail.com
*/ 
package com.session8; 

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class ClientListener extends Thread {
	private Socket socket;
	private Boolean running = true;
	public ClientListener(Socket socket) {
		this.socket = socket;
	}
	@Override
	public void run() {
		BufferedReader buff;
		try {
			buff = new BufferedReader(new InputStreamReader( socket.getInputStream()));
			String str = null;
			while(this.running){
				while ((str = buff.readLine())!= null){
					System.out.println(str);
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}